package com.huige.wiki.controller;

import com.huige.wiki.resp.StatisticResp;
import com.huige.wiki.service.EbookSnapshotService;
import com.huige.wiki.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ebook-snapshot")
@Api(tags ="统计相关")
public class EbookSnapshotController {
    @Resource
    private EbookSnapshotService ebookSnapshotService;

    @ApiOperation("获取今天和昨日电子快照")
    @GetMapping("/get-statistic")
    public Result<List<StatisticResp>> getStatistic() {
        List<StatisticResp> statisticResps = ebookSnapshotService.getStatistic();
        return Result.success(statisticResps);
    }

    @ApiOperation("获取近30天电子快照")
    @GetMapping("/get-30-statistic")
    public Result<List<StatisticResp>> get30Statistic() {
        List<StatisticResp> statisticResps = ebookSnapshotService.get30Statistic();
        return Result.success(statisticResps);
    }
}
